const http = {
    post:function(url,data,callback){
        let xhr = new XMLHttpRequest();
        xhr.open('post',url);
        xhr.setRequestHeader('content-type','application/json');
        data = JSON.stringify(data);
        xhr.send(data)
        xhr.onreadystatechange = function(){
            if(xhr.readyState ===4 && xhr.status==200){
                callback(JSON.parse(xhr.responseText))
            }
        }
    }
}